<?php
class ContatoController extends Zend_Controller_Action {

    public function indexAction(){
        if( $this->_request->isXmlHttpRequest() ){
            $this->_helper->layout()->disableLayout();
            $this->_helper->viewRenderer->setNoRender();
            echo 'somente texto';
        }

        if( $this->_request->isPost() ){
            $post = ($this->_request->getPost());
            $textMail = "<html><body>";
            foreach($post as $k => $v){
                $textMail .= "<br/>" . $k . " - " . $v;
            }
            $textMail .= "</body></html>";

            $config = array(
                'username'  => 'maildestinospan@gmail.com',
                'password'  => 'maildestinospan',
                'port'      => '587',
                'ssl'       => 'tls'
            );

            $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);

            $mail = new Zend_Mail();
            $mail->setBodyText($textMail);
            $mail->setFrom('0010587@feevale.br', 'Ecommerce');
            $mail->addTo('tihmail@gmail.com', 'Tiago Santos');
            $mail->setSubject('Contato Ecommerce');
            if( $mail->send($transport) ){
                die('email enviado');
            }else{
                var_dump($mail);
                die('erro ao enviar');
            }

        }
    }
    
}